using Arcane.Source.Combat;
using Godot;

namespace Arcane.Source.Client.Extensions;

public static class MetaExt
{
    public static Variant ToVariant(this Meta.Val val)
    {
        return val.ty switch
        {
            Meta.Type.Bool => val.AsBool(),
            Meta.Type.Int => val.AsInt32(),
            Meta.Type.Float => val.AsSingle(),
            _ => new(),
        };
    }

    public static Meta.Val ToMetaVal(this Variant v)
    {
        return v.VariantType switch
        {
            Variant.Type.Bool => new(v.AsBool()),
            Variant.Type.Int => new(v.AsInt32()),
            Variant.Type.Float => new(v.AsSingle()),
            _ => new(),
        };
    }
}